#lang racket

;(define (make-account balance)
;  (define (withdraw amount)
;    (if (>= balance amount)
;        (begin (set! balance (- balance amount))
;               balance)
;        "not enough credits on account"))
;  (define (deposit amount)
;    (set! balance (+ balance amount))
;    balance)
;  (define (dispatch m)
;    (cond ((eq? m 'withdraw) witchdraw)
;          ((eq? m 'deposit) deposit)
;    (else (error "unknown parameter: " m))))
;  dispatch)

(define (make-account balance password)
  (define (blind x) (display ""))
  (define (withdraw amount)
    (if (>= balance amount)
        (begin (set! balance (- balance amount))
               balance)
        "not enough credits on account"))
  (define (deposit amount)
    (set! balance (+ balance amount))
    balance)
  (define (dispatch pw m)
    (if (eq? password pw)
        (cond ((eq? m 'withdraw) withdraw)
              ((eq? m 'deposit) deposit)
              (else (error "unknown parameter: " 
                           m)))
        (begin (display "wrong password")
               blind)))
  dispatch)

(define acc (make-account 100 '1024))

((acc '1024 'withdraw) 40)

((acc '1023 'deposit) 50)